SAN存储运维实践

在日常使用中,SAN存储运行稳定性极高,如出现问题多数是因为中间链路问题,如光模块、HBA卡、光纤等。

若遇到IO Error,但存储侧未反馈有问题,可从以下方面进行检查。

光模块检查实践

1. 安装lldp并启动和设置邻居关系

[root@172-31-250-6 ~]# service lldpad status

2. 建立关系

[root@172-31-250-6 ~]# lldptool set-lldp -i em1 adminStatus=rxtx
adminStatus = rxtx

3. 查询信息

[root@172-31-250-6 ~]# lldptool -t -n -i em1                 
Chassis ID TLV
        MAC: 48:xx:xx:xx:xx:51  #mac地址
Port ID TLV
        Ifname: GE1/0/1    #网线插在交换机上的端口位置
Time to Live TLV
        120
System Name TLV
        xx-xx-CE5850-xxxxx  #交换机设备名
System Description TLV
        Huawei Versatile Routing Platform Software
VRP (R) software, Version 8.150 (CE5855EI V200R002C50SPC800)
Copyright (C) 2012-2017 Huawei Technologies Co., Ltd.
HUAWEI CE5855-xxxx-xxx  #华为的交换机

System Capabilities TLV
        System capabilities:  Bridge, Router
        Enabled capabilities: Bridge, Router
Management Address TLV
        IPv4: xx.xxx.xxx.xx  #ip地址
        Ifindex: 4
        OID: +[)
Port VLAN ID TLV
        PVID: 
Port and Protocol VLAN ID TLV
        PVID: 0, not supported, not enabled
VLAN Name TLV
        VID 3652: Name VLAN3652
MAC/PHY Configuration Status TLV
        Auto-negotiation supported and enabled
        PMD auto-negotiation capabilities: 0xxxxx
        MAU type: 1000 BaseXFD
Link Aggregation TLV
        Aggregation capable
        Currently not aggregated
        Aggregated Port ID: 0
Maximum Frame Size TLV
        9216
End of LLDPDU TLV

4. 查看是否为光模块

[root@172-31-250-6 ~]# ethtool em1 | grep "Supported ports:"
    Supported ports: [ FIBRE ]

5. 查看光模块型号

[root@172-31-250-6 ~]# ethtool -m em1 | grep -E "Vendor name|Vendor PN"
    Vendor name                               : OEM
    Vendor PN                                 : SFP-H10GB-CU3M

6. 查看光模块具体信息

[root@172-31-250-6 ~]# ethtool -m em1
    Identifier                                : 0x03 (SFP)
    Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
    Connector                                 : 0x21 (Copper pigtail)
    Transceiver codes                         : 0x00 0x00 0x00 0x00 0x00 0x04 0x00 0x00
    Transceiver type                          : Passive Cable
    Encoding                                  : 0x00 (unspecified)
    BR, Nominal                               : 10300MBd
    Rate identifier                           : 0x00 (unspecified)
    Length (SMF,km)                           : 0km
    Length (SMF)                              : 0m
    Length (50um)                             : 0m
    Length (62.5um)                           : 0m
    Length (Copper)                           : 3m
    Length (OM3)                              : 0m
    Passive Cu cmplnce.                       : 0x01 (SFF-8431 appendix E) [SFF-8472 rev10.4 only]
    Vendor name                               : OEM
    Vendor OUI                                : 00:40:20
    Vendor PN                                 : SFP-H10GB-CU3M
    Vendor rev                                : 03
    Option values                             : 0x00 0x00
    BR margin, max                            : 0%
    BR margin, min                            : 0%
    Vendor SN                                 : CSS31H10021
    Date code                                 : 170101

7. 查看收发光

收光:ethtool -m em1 | grep "Receiver signal" |  head -1 | awk -F '/' '{print $2}'
发光:ethtool -m em1 | grep "Laser output power" |  head -1 | awk -F '/' '{print $2}'

HBA卡检查实践

1. 查看HBA卡状态

[root@172-31-250-6 ~]# cat /sys/devices/pci0000:80/0000:80:02.0/0000:82:00.1/host12/fc_host/host12/port_state
Online
ech0 1 > /sys/class/fc_host/host*/issue_lip重新down/up端口测试

2. 查看message日志中HBA卡日志

[root@zstack-mn anhhuietc]# grep -i 'QLogic' messages-204 
Feb  2 18:21:57 localhost kernel: qla2xxx [0000:00:00.0]-0005: : QLogic Fibre Channel HBA Driver: 10.00.00.06.07.6-k.
Feb  2 18:22:00 localhost kernel: qla2xxx [0000:86:00.0]-00fb:15: QLogic QLE2690 - QLogic 16Gb 1-port FC to PCIe Gen3 x8 Adapter.
Jun 22 04:39:01 localhost kernel: qla2xxx [0000:00:00.0]-0005: : QLogic Fibre Channel HBA Driver: 10.00.00.06.07.6-k.
Jun 22 04:39:04 localhost kernel: qla2xxx [0000:86:00.0]-00fb:15: QLogic QLE2690 - QLogic 16Gb 1-port FC to PCIe Gen3 x8 Adapter.

3. lspci查看HBA卡信息

[root@172-31-250-6 scripts]# lspci |grep -i qlo
82:00.0 Fibre Channel: QLogic Corp. ISP8324-based 16Gb Fibre Channel to PCI Express Adapter (rev 02)
82:00.1 Fibre Channel: QLogic Corp. ISP8324-based 16Gb Fibre Channel to PCI Express Adapter (rev 02)
[root@172-31-250-6 scripts]# lspci -vvvvv -s82:00.0
82:00.0 Fibre Channel: QLogic Corp. ISP8324-based 16Gb Fibre Channel to PCI Express Adapter (rev 02)
    Subsystem: QLogic Corp. Device 0257
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 32 bytes
    Interrupt: pin A routed to IRQ 82
    NUMA node: 1
    Region 0: Memory at c820a000 (64-bit, prefetchable) [size=8K]
    Region 2: Memory at c8204000 (64-bit, prefetchable) [size=16K]
    Region 4: Memory at c8100000 (64-bit, prefetchable) [size=1M]
    Expansion ROM at c8400000 [disabled] [size=256K]
    Capabilities: [44] Power Management version 3
        Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold+)

4. systool查看HBA卡信息,以下仅列关键信息

[root@172-31-250-6 scripts]# systool -c fc_host -v
Class = "fc_host"

  Class Device = "host11"
  Class Device path = "/sys/devices/pci0000:80/0000:80:02.0/0000:82:00.0/host11/fc_host/host11"
    dev_loss_tmo        = "30"
    fabric_name         = "0x10000027f8b79b75"      #fabric的wwn(存储交换机)
    issue_lip           = <store method only>
    max_npiv_vports     = "254"
    node_name           = "0x2000000ed7da8c81"       #wwnn
    npiv_vports_inuse   = "0"
    port_id             = "0x010700"
    port_name           = "0x2001000ed7da8c81"      #wwpn
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"       #HBA卡这一端
    speed               = "16 Gbit"
    supported_classes   = "Class 3"
    supported_speeds    = "4 Gbit, 8 Gbit, 16 Gbit"
    symbolic_name       = "QLE2662 FW:v6.04.00 DVR:v10.01.00.33.07.6-k"

  Class Device = "host12"
  Class Device path = "/sys/devices/pci0000:80/0000:80:02.0/0000:82:00.1/host12/fc_host/host12"
    dev_loss_tmo        = "30"
    fabric_name         = "0x1000889471ad1680"      
    issue_lip           = <store method only>
    max_npiv_vports     = "254"
    node_name           = "0x2000000ed7da8c82"      #wwnn与前面差一位,说明是同一张HBA卡的另一个端口
    npiv_vports_inuse   = "0"
    port_id             = "0x010700"
    port_name           = "0x2001000ed7da8c82"      #wwpn
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"       
    speed               = "16 Gbit"     #速率
    supported_classes   = "Class 3"
    supported_speeds    = "4 Gbit, 8 Gbit, 16 Gbit"
    symbolic_name       = "QLE2662 FW:v6.04.00 DVR:v10.01.00.33.07.6-k"

[root@172-31-250-6 ~]# cd /opt/zstack-dvd/x86_64/c76/scripts/
[root@172-31-250-6 scripts]# ./mapdevs -H       #查看本机信息

#scsi_addr   name                   version                f/w                       device
#----------- ---------------------- ---------------------- ------------------------- ----------------------------------------------
 0:*:*:*     megaraid_sas           07.705.02.00-rh1                                 /sys/devices/pci0000:00/0000:00:01.0/0000:02:00.0/host0
 1:*:*:*     ahci                   3.0                                              /sys/devices/pci0000:00/0000:00:11.4/ata1/host1
 2:*:*:*     ahci                   3.0                                              
#            --------- PCI -------------
#                          subsystem      model        model
#scsi_addr   vendor device vendor device  name         description
#----------- ------ ------ ------ ------  ------------ --------------------------------------------------
 0:*:*:*     0x1000 0x005f 0x1028 0x1f4b               <S:PERC H330 Mini>
 1:*:*:*     0x8086 0x8d62 0x1028 0x0627               <D:C610/X99 series chipset sSATA Controller [AHCI mode]>
 2:*:*:*     0x8086 0x8d62 0x1028 0x0627               <D:C610/X99 series chipset sSATA Controller [AHCI mode]>
.....
 10:*:*:*    0x8086 0x8d02 0x1028 0x0627               <D:C610/X99 series chipset 6-Port SATA Controller [AHCI mode]>
 11:*:*:*    0x1077 0x2031 0x1077 0x0257  QLE2662      QLogic QLE2662 Dual Port FC16 HBA        #HBA卡型号
 12:*:*:*    0x1077 0x2031 0x1077 0x0257  QLE2662      QLogic QLE2662 Dual Port FC16 HBA        #HBA卡型号

#scsi_addr   name        speed    state    symbolic_name                                  port_type
#----------- ---------- -------- -------- ----------------------------------------- ----------------------------
 11:*:*:*    qla2xxx      16 Gbit  Online   QLE2662 FW:v6.04.00 DVR:v10.01.00.33.07.6-k    NPort (fabric via point-to-point)
 12:*:*:*    qla2xxx      16 Gbit  Online   QLE2662 FW:v6.04.00 DVR:v10.01.00.33.07.6-k    NPort (fabric via point-to-point)

#scsi_addr     Vendor   Model            Rev  sdN        sgX      Lun-alias  Lun-wwid                   Tgt-alias  Tgt-wwpn
#------------ -------- ---------------- ---- -------- ---------- ---------- ------------------------ ---------- --------------
[0:0:0:0]      TOSHIBA  PX02SMF040       A3AF /dev/sda   /dev/sg0   -          50000395ac899438                 -          -     
[0:0:1:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sdb   /dev/sg1   -          500003969ba82391                 -          -     
[0:0:4:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sdc   /dev/sg2   -          500003968b78329a                 -          -     
[0:0:5:0]      ATA      TOSHIBA MG03ACA2 FL1H /dev/sdd   /dev/sg3   -          50000395fbf8280d                 -          -     
[0:0:6:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sde   /dev/sg4   -          500003968b70395d                 -          -     
[0:0:7:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sdf   /dev/sg5   -          500003969ba8238f                 -          -     
[0:0:8:0]      ATA      TOSHIBA MG03ACA2 FL1H /dev/sdg   /dev/sg6   -          50000395fb805e0f                 -          -     
[0:0:9:0]      TOSHIBA  PX02SMF040       A3AF /dev/sdh   /dev/sg7   -          50000395ac89943c                 -          -     
[0:2:0:0]      DELL     PERC H330 Mini   4.27 /dev/sdi   /dev/sg8   -          61866da08ad30400260c579711aaeab3 -          -     
[11:0:0:1]     COMPELNT Compellent Vol   0704 /dev/sdj   /dev/sg9   LunA-0001  5000d310056ffa00                 - 0x5000d310056ffa3d
[11:0:1:1]     COMPELNT Compellent Vol   0704 /dev/sdk   /dev/sg10  LunA-0001  5000d310056ffa00                 -          0x5000d310056ffa3a
[12:0:0:1]     COMPELNT Compellent Vol   0704 /dev/sdl   /dev/sg11  LunA-0001  5000d310056ffa00                 -          0x5000d310056ffa41
[12:0:1:1]     COMPELNT Compellent Vol   0704 /dev/sdm   /dev/sg12  LunA-0001  5000d310056ffa00                 -          0x5000d310056ffa3e
[root@172-31-250-6 scripts]# ./mapdevs -wpx
#scsi_addr     Vendor   Model            Rev  sdN        sgX        Lun-alias  Lun-wwid                    Tgt-alias  Tgt-wwpn
#------------- -------- ---------------- ---- ---------- ---------- ---------- ---------------------------- ---------- -----
[0:0:0:0]      TOSHIBA  PX02SMF040       A3AF /dev/sda   /dev/sg0   -          50000395ac899438                 -          -     
[0:0:1:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sdb   /dev/sg1   -          500003969ba82391                 -          -     
[0:0:4:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sdc   /dev/sg2   -          500003968b78329a                 -          -     
[0:0:5:0]      ATA      TOSHIBA MG03ACA2 FL1H /dev/sdd   /dev/sg3   -          50000395fbf8280d                 -          -     
[0:0:6:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sde   /dev/sg4   -          500003968b70395d                 -          -     
[0:0:7:0]      ATA      TOSHIBA MG03ACA2 FL2H /dev/sdf   /dev/sg5   -          500003969ba8238f                 -          -     
[0:0:8:0]      ATA      TOSHIBA MG03ACA2 FL1H /dev/sdg   /dev/sg6   -          50000395fb805e0f                 -          -     
[0:0:9:0]      TOSHIBA  PX02SMF040       A3AF /dev/sdh   /dev/sg7   -          50000395ac89943c                 -          -     
[0:2:0:0]      DELL     PERC H330 Mini   4.27 /dev/sdi   /dev/sg8   -          61866da08ad30400260c579711aaeab3 -          -     
[11:0:0:1]     COMPELNT Compellent Vol   0704 /dev/sdj   /dev/sg9   LunA-0001  5000d310056ffa00                 -          0x5000d310056ffa3d
[11:0:1:1]     COMPELNT Compellent Vol   0704 /dev/sdk   /dev/sg10  LunA-0001  5000d310056ffa00                 -          0x5000d310056ffa3a
[12:0:0:1]     COMPELNT Compellent Vol   0704 /dev/sdl   /dev/sg11  LunA-0001  5000d310056ffa00                 -          0x5000d310056ffa41
[12:0:1:1]     COMPELNT Compellent Vol   0704 /dev/sdm   /dev/sg12  LunA-0001  5000d310056ffa00                 -          0x5000d310056ffa3e

%F-cannot find target 0:0:2 within host 0, exiting...

5. Qlogic HBA卡系统日志debug开启方法

使用以下命令在/etc/modprobe.d/目录下创建新文件。
# vi /etc/modprobe.d/qlogic

在文件的末尾添加以下模块选项,要禁用扩展日志,请使用#注释掉下面一行。
options qla2xxx ql2xextended_error_logging=1

reboot

观察/var/log/messages中的扩展日志。
# tail -f /var/log/message

6. Emulex HBA卡系统日志debug开启方法

提高HBA卡日志打印级别,如果elx-lpfc.conf不存在则新建。
#vim /etc/modprobe.d/elx-lpfc.conf

加入以下行:
options lpfc lpfc_log_verbose=0x10c7 (或者0x10c3,0x10c7级别更高)

保存退出:
#dracut --force

#reboot

观察/var/log/messages中的扩展日志。
# tail -f /var/log/message

7. HBA卡管理工具--相关软件见文章开始的链接

  • 下面以Qlogic的Cli为例,需关注的一般是Adapter Diagnostics和Monitoring:
[root@172-31-250-6 c76]# qaucli 
Using config file: /opt/QLogic_Corporation/QConvergeConsoleCLI/qaucli.cfg
Installation directory: /opt/QLogic_Corporation/QConvergeConsoleCLI
Working dir: /opt/zstack-dvd/x86_64/c76
    QConvergeConsole
    CLI - Version 2.4.1 (Build 7)
    Main Menu
    1:    Adapter Information
    2:    Adapter Configuration
    3:    Adapter Updates
    4:    Adapter Diagnostics
    5:    Monitoring
    6:    Refresh
    7:    Help
    8:    Exit
    Please Enter Selection: 4

    QConvergeConsole
    CLI - Version 2.4.1 (Build 7)
    FC Diagnostics
    1:    Loopback Test
    2:    Read Write Buffer Test
    3:    Beacon
    4:    Transceiver Diagnostics Monitoring Interface (DMI)
    5:    FCE Trace
    6:    Device Ping Test
    7:    CT Ping Test
    8:    CT FTR Test
    9:    Link Status
   10:    Diagnostics Port Test
   11:    FC Ping Test
   12:    RDP Test
    (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
    Please Enter Selection: 9

    QConvergeConsole
    CLI - Version 2.4.1 (Build 7)
    FC Diagnostics
    HBA Model QLE2662 SN: RFE1816H46949
      1: Port   1: WWPN: 20-01-00-0E-D7-DA-8C-81 Online
      2: Port   2: WWPN: 20-01-00-0E-D7-DA-8C-82 Online 
    (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
    Please Enter Selection: 1

    QConvergeConsole
    CLI - Version 2.4.1 (Build 7)
    Link Status Menu
=======================================================
HBA           : 0 Port: 1
SN            : RFE1816H46949
HBA Model     : QLE2662
HBA Desc.     : QLE2662 QLogic 2-port 16Gb Fibre Channel Adapter
FW Version    : 6.04.00
WWPN          : 20-01-00-0E-D7-DA-8C-81
WWNN          : 20-00-00-0E-D7-DA-8C-81
Link          : Online
=======================================================
    1:    View Current Settings
    2:    Modify Settings
    3:    Reset Link Status Counters
    4:    HBA Link Status
    (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
    Please Enter Selection: 4
---------------------------------------
Link Status Settings
---------------------------------------
AutoPoll (AP): 10
SetRate (SR): 5
LogToFile (LF): N/A
--------------------------------------------------------------------------------
HBA Instance 0: QLE2662 Port 1 WWPN 20-01-00-0E-D7-DA-8C-81 PortID 01-07-00
Link: Online
--------------------------------------------------------------------------------
Link Status
-------------------------------------------
General keyboard shortcuts:
      R     - Reset current
      C     - Refresh current
      T     - Refresh total
      ENTER - Cancel the current task
-------------------------------------------
Port Name               Link     Sync     Signal   Invalid  Seq Proto   Invalid     
                        Failure  Loss     Loss     CRC      Error       Trans Word      
----------------------- -------- -------- -------- -------- ---------   -----------
20-01-00-0E-D7-DA-8C-81        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3D        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3A        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3B        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3C        0        0        0        0         0          0
--------------------------------------------------------------------------------
HBA Instance 0: QLE2662 Port 1 WWPN 20-01-00-0E-D7-DA-8C-81 PortID 01-07-00
Link: Online
--------------------------------------------------------------------------------
Link Status
-------------------------------------------
General keyboard shortcuts:
      R     - Reset current
      C     - Refresh current
      T     - Refresh total
      ENTER - Cancel the current task
-------------------------------------------
Port Name               Link     Sync     Signal   Invalid  Seq Proto   Invalid     
                        Failure  Loss     Loss     CRC      Error       Trans Word      
----------------------- -------- -------- -------- -------- ---------   -----------
20-01-00-0E-D7-DA-8C-81        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3D        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3A        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3B        0        0        0        0         0          0
50-00-D3-10-05-6F-FA-3C        0        0        0        0         0          0
  • 故障时会存在如下情况

光纤检查实践

  • 常见光纤被折断,或弯曲半径过小导致通信异常,需更换光纤。

ISCSI链路检查实践

Jul 30 16:10:01 jisuan-06 systemd: Started Session 79495 of user root.
Jul 30 16:20:01 jisuan-06 systemd: Started Session 79496 of user root.
Jul 30 16:30:01 jisuan-06 systemd: Started Session 79497 of user root.
Jul 30 16:35:34 jisuan-06 kernel: connection3:0: ping timeout of 5 secs expired, recv timeout 5, last rx 44722708016, last ping 44722713024, now 44722718032
Jul 30 16:35:34 jisuan-06 kernel: connection3:0: detected conn error (1022)
Jul 30 16:35:35 jisuan-06 iscsid: Kernel reported iSCSI connection 3:0 error (1022 - Invalid or unknown error code) state (3)
Jul 30 16:35:35 jisuan-06 kernel: connection4:0: ping timeout of 5 secs expired, recv timeout 5, last rx 44722709024, last ping 44722714032, now 44722719040
Jul 30 16:35:35 jisuan-06 kernel: connection4:0: detected conn error (1022)
Jul 30 16:35:36 jisuan-06 iscsid: Kernel reported iSCSI connection 4:0 error (1022 - Invalid or unknown error code) state (3)
Jul 30 16:35:37 jisuan-06 iscsid: connection3:0 is operational after recovery (1 attempts)
Jul 30 16:35:38 jisuan-06 iscsid: connection4:0 is operational after recovery (1 attempts)
Jul 30 16:35:47 jisuan-06 kernel: connection3:0: ping timeout of 5 secs expired, recv timeout 5, last rx 44722720879, last ping 44722725879, now 44722730880
Jul 30 16:35:47 jisuan-06 kernel: connection3:0: detected conn error (1022)
Jul 30 16:35:47 jisuan-06 kernel: connection4:0: ping timeout of 5 secs expired, recv timeout 5, last rx 44722721282, last ping 44722726282, now 44722731296
Jul 30 16:35:47 jisuan-06 kernel: connection4:0: detected conn error (1022)
Jul 30 16:35:48 jisuan-06 iscsid: Kernel reported iSCSI connection 3:0 error (1022 - Invalid or unknown error code) state (3)
Jul 30 16:35:48 jisuan-06 iscsid: Kernel reported iSCSI connection 4:0 error (1022 - Invalid or unknown error code) state (3)
Jul 30 16:35:49 jisuan-06 kernel: connection7:0: ping timeout of 5 secs expired, recv timeout 5, last rx 44722723451, last ping 44722728456, now 44722733473
Jul 30 16:35:49 jisuan-06 kernel: connection7:0: detected conn error (1022)
Jul 30 16:35:50 jisuan-06 iscsid: Kernel reported iSCSI connection 7:0 error (1022 - Invalid or unknown error code) state (3)
Jul 30 16:35:51 jisuan-06 iscsid: connection4:0 is operational after recovery (1 attempts)
Jul 30 16:35:51 jisuan-06 kernel: sd 18:0:0:0: alua: port group 01 state N non-preferred supports tolusna
Jul 30 16:35:51 jisuan-06 kernel: connection2:0: ping timeout of 5 secs expired, recv timeout 5, last rx 44722724877, last ping 44722729888, now 44722734896
Jul 30 16:35:51 jisuan-06 kernel: connection2:0: detected conn error (1022)

网络监控脚本

#!/bin/bash 
PASSWORD=password 
count=0 
logfile=./pingchk.log 
while true; do  count=$((count+1))    
    cur_time=`date "+%Y-%m-%d %H:%M:%S"`  
    for ip in `cat ./iplst.txt`; do   
    r=`ping -c 1 $ip|grep packets`    
    echo "${cur_time} | ping | ${count} | ${ip} | ${r}" >> ${logfile}      
    echo 'exit;'|setsid env SSH_ASKPASS=${PASSWORD} DISPLAY='none:0' ssh -o ConnectTimeout=1 -o StrictHostKeyChecking=no root@${ip} > /dev/null 2>&1    
    if [[ $? -ne 0 ]]; then      
        echo "${cur_time} |  ssh | ${count} | ${ip} | bad" >> ${logfile}             else      echo "${cur_time} |  ssh | ${count} | ${ip} | ok" >> ${logfile}     
        fi   
        done  
        echo -e >> ${logfile}   
        sleep 1 
done

扩展阅读

  • 要查看服务器中安装的所有Emulex HBA,可以用 "hbacmd listhbas"
root@localhost ~]#hbacmd listhbas
Manageable HBA List

Port WWN : 10:00:00:00:c9:49:28:42
Node WWN : 20:00:00:00:c9:49:28:42
Fabric Name: 10:00:00:60:69:80:2d:ee
Flags : 8000f980
Host Name : server01
Mfg : Emulex Corporation

Port WWN : 10:00:00:00:c9:49:28:47
Node WWN : 20:00:00:00:c9:49:28:47
Fabric Name: 10:00:00:60:69:80:0e:fc
Flags : 8000f980
Host Name : fraudmgmt01
Mfg : Emulex Corporation

[ ..... ]
  • 列出固件版本、序列号、WWN和各种型号的具体信息,可以用 "hbaattrib "
root@localhost ~]#hbacmd HBAAttrib 10:00:00:00:c9:49:28:47
HBA Attributes for 10:00:00:00:c9:49:28:47

Host Name : server01
Manufacturer : Emulex Corporation
Serial Number : MS51403247
Model : LP9802
Model Desc : Emulex LightPulse LP9802 2 Gigabit PCI Fibre Channel Adapter
Node WWN : 20 00 00 00 c9 49 28 47
Node Symname : Emulex LP9802 FV1.91A1 DV6.02f
HW Version : 2003806d
Opt ROM Version: 1.50a4
FW Version : 1.91A1 (H2D1.91A1)
Vender Spec ID : 80F9
Number of Ports: 1
Driver Name : lpfc
Device ID : F980
HBA Type : LP9802
Operational FW : SLI-2 Overlay
SLI1 FW : SLI-1 Overlay 1.91a1
SLI2 FW : SLI-2 Overlay 1.91a1
IEEE Address : 00 00 c9 49 28 47
Boot BIOS : Fcode Firmware1.50a4
Driver Version : 6.02f; HBAAPI(I) v2.0.e, 11-07-03
  • 要查看主机端口信息(例如,端口速度,设备路径)和结构参数(例如结构ID(S_ID),与此端口一起分区的#个端口),可以用 "portattrib "
root@localhost ~]#hbacmd PortAttrib 10:00:00:00:c9:49:28:47
Port Attributes for 10:00:00:00:c9:49:28:47

Node WWN : 20 00 00 00 c9 49 28 47
Port WWN : 10 00 00 00 c9 49 28 47
Port Symname :
Port FCID : 6D0900
Port Type : Fabric
Port State : Operational
Port Service Type : 6
Port Supported FC4 : 00 00 01 20 00 00 00 01
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Port Active FC4 : 00 00 01 20 00 00 00 01
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Port Supported Speed: 2 GBit/sec.
Port Speed : 2 GBit/sec.
Max Frame Size : 2048
OS Device Name : /devices/pci@84,2000/lpfc@1
Num Discovered Ports: 3
Fabric Name : 10 00 00 60 69 80 0e fc
  • 查看统计数据:
hbacmd PortStatistics wwpn
  • Emulex 的 CLI 安装:

    • 首先安装位于 zstack-dvd 的 libnl,然后解压 elxocmcore 这个 tgz 包,并执行 ./install.sh。
    • 默认是交互式安装,操作较繁琐,也可以通过 ./install -q2 来安装,默认安装选项禁止掉了各种远程管理。
root@localhost ~]# cd /opt/zstack-dvd/Packages/
[root@localhost Packages]# rpm -ivh ./libnl-1.1.4-3.el7.x86_64.rpm
warning: ./libnl-1.1.4-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:libnl-1.1.4-3.el7                ################################# [100%]
[root@localhost Packages]# cd
[root@localhost ~]# tar -xf elxocmcore-rhel6-rhel7-rhel8-12.0.261.13-1.tgz
[root@localhost ~]# cd elxocmcore-rhel6-rhel7-rhel8-12.0.261.13-1/
[root@localhost elxocmcore-rhel6-rhel7-12.0.193.22-1]# ./install.sh
Beginning OneCommand Manager Core Kit Installation...
Installing ./x86_64/rhel-7/elxocmcorelibs-12.0.193.22-1.x86_64.rpm
Installing ./x86_64/rhel-7/hbaapiwrapper-32bit-12.0.193.22-1.x86_64.rpm
Installing ./x86_64/rhel-7/hbaapiwrapper-12.0.193.22-1.x86_64.rpm
Installing ./x86_64/rhel-7/elxocmcore-12.0.193.22-1.x86_64.rpm

Stopping OneCommand Manager daemons ...

Do you want to enable Secure Management feature for OneCommand? (s/u)

The secure management feature requires OneCommand groups be configured on
the LDAP network or the local host machine to provide for OneCommand operation.

Enter 's' to select secure management. (LDAP/NIS OCM group configuration required)
Enter 'u' to run without secure management (default).
Enter the letter 's' or 'u': u
You selected: Secure Management Disabled

Select desired mode of operation for OneCommand Manager
   1   Strictly Local Management : Only manage the adapters on this host.
                                   Management of adapters on this host from other
                                   hosts is not allowed.
   2   Local Management Plus     : Only manage the adapters on this host.
                                   Management of adapters on this host from other
                                   hosts is allowed.
   3   Full Management           : Manage the adapters on this host and other
                                   hosts that allow it.  Management of the adapters
                                   on this host from another host is allowed.
   4   Management Host           : Manage the adapters on this host and other hosts
                                   that allow it.  Management of the adapters on
                                   this host from another host is not allowed.

Enter the number 1, 2, 3, or 4: 3
You selected: 'Remote Mode'

Do you want to enable TCP/IP Management to/from remote hosts? (Y/N)

Enter 'y' to enable TCP/IP remote management (default).
Enter 'n' to disable TCP/IP remote management.

Enter the letter 'y' or 'n': y
You selected: enable TCP/IP remote management

Enter management host address (blank for none):

Enter TCP/IP port number to use or blank for default (23333):

Would you like to enable configuration features for OneCommand
Manager clients on this platform?

Enter 'y' to allow configuration (default).
Enter 'n' for read-only mode.

Enter the letter 'y' or 'n': y
You selected: Yes, enable configuration

Do you want to allow user to change management mode using
set_operating_mode script located in /usr/sbin/ocmanager ?

Enter the letter 'y' if yes, or 'n' if no: y
You selected: Yes

OneCommand Manager Core Kit install completed successfully.
If you also have OneConnect adapters installed, please download and install the latest OneConnect software kits.

Type:    /usr/sbin/ocmanager/hbacmd
to run the OneCommand Manager CLI utility.

results matching ""

    No results matching ""